package main

import (
	item "example_shop/kitex_gen/example/shop/item/itemservice"
	"github.com/cloudwego/kitex/server"
	"log"
	"net"
)

func main() {
	itemSrv := new(ItemServiceImpl)
	stockCli, err := NewStockClient("0.0.0.0:10003")
	if err != nil {
		panic(err)
	}

	itemSrv.stockCli = stockCli

	addr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:10002")
	if err != nil {
		panic(err)
	}

	svr := item.NewServer(itemSrv, server.WithServiceAddr(addr))

	err = svr.Run()
	if err != nil {
		log.Println(err.Error())
	}
}
